<template>
  <div>
    <!-- 位置栏 -->
    <div class="location-bar">
      <div>位置 :&ensp;</div>
      <div @click="cancel">新闻列表</div>
      <div style="color: #000">/查看新闻</div>
    </div>
    <div class="content-box">
      <div class="title">{{ content.title }}</div>
      <div class="image"><img :src="cdn + content.cover" alt="" srcset="" /></div>
      <div class="text">{{ content.content }}</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      id: '',
      content: [],
    };
  },
  created() {
    this.id = this.$route.params.id; //查看文章编号
    this.loadArticleList();
  },
  methods: {
    //读取文章信息
    async loadArticleList() {
      let reqData = {};
      let reqParam = { id: this.id };
      let findUrl = `/news/find/${reqParam.id}`;
      let result = await this.axios.get(findUrl, reqData);
      console.log(result);
      this.content = result.data.data;
      console.log(this.content);
    },
    //返回新闻列表
    cancel() {
      this.$router.push({
        name: 'Newslist',
      });
    },
  },
};
</script>

<style>
.location-bar {
  display: flex;
  font-size: 14px;
  color: #88898b;
}
.content-box {
  width: 100%;
  height: 1000px;
  background-color: #ffffff;
  margin-top: 20px;
  box-sizing: border-box;
}
.title {
  font-size: 35px;
  text-align: center;
  line-height: 100px;
  font-weight: 600px;
  height: 100px;
  border-bottom: 1px solid #000;
}
.image {
  width: 500px;
  /* height: 500px; */
  margin: auto;
}
.image img{
  width: 500px;
  /* height: 500px; */
}
.text {
  text-align: center;
}
</style>